<template>
  <el-dialog :visible.sync="visible" :width="width" :before-close="handleClose" class="taskDialog">
    <!-- <span>这是一段信息</span> -->
    <baseTitle slot="title" :title="title"></baseTitle>
    <slot name="content"></slot>
    <span slot="footer" class="dialog-footer">
      <el-button @click="close" size="mini">取 消</el-button>
      <el-button type="primary" @click="comfire" size="mini">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
import baseTitle from "@/components/baseTitle";
export default {
  name: "taskDialog",
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    closeCheck: {
      type: Function,
      default: () => true
    },
    title: {
      type: String,
      default: ""
    },
    width: {
      type: [String, Number],
      default: "30%"
    }
  },
  components: {
    baseTitle
  },
  methods: {
    handleClose () {
      this.close();
      // this.$emit("close")
    },
    close () {
      this.$emit("update:visible", false);
      // this.$emit("close")
    },
    comfire () {
      if (this.closeCheck()) {
        this.$emit("update:visible", false);
        this.$emit("comfire");
      }
    }
  }
};
</script>

<style lang="less" scoped>
.taskDialog {
  /deep/ .el-dialog__header {
    padding: 5px 0;
  }
  /deep/ .el-dialog__body {
    padding: 5px 10px;
  }
}
</style>
